<?php
class Core_Data_Mappers_Zone extends Core_Data_Mappers_Abstract {
	protected $_businessclass = "Core_Business_Zone";
	protected $_modelclass = "Core_Data_Models_Zone";
	protected $_map=array("Commune"=>"commune","Zipcode"=>"zipcode","Departement"=>"departement","Dep"=>"departementcode","Insee"=>"codeinsee");
	
	public function add($object) {}
	public function edit($object) {}
	public function exists($object) {}
	/**
	 * Return all zone with zipcode equals with the parameter zipcode
	 * 
	 * @param string $zipcode
	 * @return array
	 */
	public function find($zipcode) {
		$rows = $this->getDbTable()->fetchAll(array("zipcode=?"=>$zipcode));
		$collection =array();
		if(isset($rows)&& count($rows)>0) {
			foreach ($rows as $item) {
				$collection[] = $this->map($item);
			}
		}
		return $collection;
	}
}